from django.apps import AppConfig


class RagConfig(AppConfig):
    default_auto_field = 'django.db.models.BigAutoField'
    name = 'rag'

    def ready(self):
        """项目启动钩子：直接执行一次岗位数据同步（ES 与 Chroma），避免额外配置。"""
        from rag.job_recommendation.job_recommendation import fetch_job, job_es_index, job_es_add, \
            job_with_text_embedding, sync_jobs_to_chroma

        es_index_name = "job_list_0927"

        # 查询job岗位信息
        #job_list = fetch_job()
        # 创建一个索引库
        # job_es_index(es_index_name)

        # 往ES添加数据
        # job_es_add(es_index_name, job_list)

        #job_text_embedding_list = job_with_text_embedding(job_list)
        #sync_jobs_to_chroma(job_text_embedding_list)
